@import "./common/mixin.scss";
@import "./common/vars.scss";
@import "./common/utils.scss";

.as-popconfirm {
  position: relative;
  display: inline-block;
  $selector: &;
  &__body {
    min-width: 160px;
    padding: 14px 20px 8px;
    background: white;
    z-index: 101;
    position: absolute;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    border-radius: 4px;
    line-height: 1;
    bottom: 40px;
    top: unset;
    left: unset;
    right: unset;
    margin: 5px 0 8px 0;
    border: solid 1px #eaeaea;
    box-sizing: border-box;
    &_title {
      font-size: 14px;
      color: #666;
      margin-bottom: 15px;
    }
    &_content {
      font-size: 14px;
      color: #333;
      line-height: 1.5;
      float: right;
    }

    &:before {
      bottom: -6px;
      border-top: solid 6px white;
      content: "";
      position: absolute;
      left: 40px;
      border-left: solid 6px transparent;
      border-right: solid 6px transparent;
    }
  }

  @include modifier(bottom) {
    #{$selector}__body {
      bottom: unset;
      top: 40px;
      left: unset;
      right: unset;
      margin: 12px 0 5px 0;
      &:before {
        top: -6px;
        bottom: unset;
        border-bottom: solid 6px white;
        border-top: none;
      }
    }
  }
  @include modifier(left) {
    #{$selector}__body {
      right: 120px;
      top: unset;
      bottom: unset;
      margin: 0 12px 0 5px;
      &:before {
        right: -12px;
        top: 10px;
        bottom: unset;
        left: unset;
        border-left: solid 6px white;
        border-bottom: solid 6px transparent;
        border-top: solid 6px transparent;
      }
    }
  }
  @include modifier(right) {
    #{$selector}__body {
      bottom: unset;
      top: unset;
      right: unset;
      left: 120px;
      margin: 0 5px 0 12px;
      &:before {
        left: -12px;
        top: 10px;
        bottom: unset;
        right: unset;
        border-right: solid 6px white;
        border-bottom: solid 6px transparent;
        border-top: solid 6px transparent;
      }
    }
  }
}
.as-popover {
  position: relative;
  display: inline-block;
  $selector: &;
  &__body {
    padding: 12px 20px;
    background: white;
    z-index: 101;
    position: absolute;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    border-radius: 4px;
    line-height: 1;
    bottom: 40px;
    top: unset;
    left: unset;
    right: unset;
    margin: 5px 0 12px 0;
    border: solid 1px #eaeaea;
    box-sizing: border-box;
    &_title {
      font-size: 16px;
      color: #666;
      margin-bottom: 10px;
    }
    &_content {
      font-size: 14px;
      color: #333;
      line-height: 1.5;
    }

    &:before {
      bottom: -6px;
      border-top: solid 6px white;
      content: "";
      position: absolute;
      left: 40px;
      border-left: solid 6px transparent;
      border-right: solid 6px transparent;
    }
  }

  @include modifier(bottom) {
    #{$selector}__body {
      bottom: unset;
      top: 40px;
      left: unset;
      right: unset;
      margin: 12px 0 5px 0;
      &:before {
        top: -6px;
        bottom: unset;
        border-bottom: solid 6px white;
        border-top: none;
      }
    }
  }
  @include modifier(left) {
    #{$selector}__body {
      right: 120px;
      top: unset;
      bottom: unset;
      margin: 0 12px 0 5px;
      &:before {
        right: -12px;
        top: 10px;
        bottom: unset;
        left: unset;
        border-left: solid 6px white;
        border-bottom: solid 6px transparent;
        border-top: solid 6px transparent;
      }
    }
  }
  @include modifier(right) {
    #{$selector}__body {
      bottom: unset;
      top: unset;
      right: unset;
      left: 120px;
      margin: 0 5px 0 12px;
      &:before {
        left: -12px;
        top: 10px;
        bottom: unset;
        right: unset;
        border-right: solid 6px white;
        border-bottom: solid 6px transparent;
        border-top: solid 6px transparent;
      }
    }
  }

  @include modifier(dark) {
    &#{$selector + "--left"} {
      #{$selector}__body {
        &:before {
          border-left-color: #333;
        }
      }
    }
    &#{$selector + "--right"} {
      #{$selector}__body {
        &:before {
          border-right-color: #333;
        }
      }
    }
    &#{$selector + "--bottom"} {
      #{$selector}__body {
        &:before {
          border-bottom-color: #333;
        }
      }
    }
    &#{$selector + "--top"} {
      #{$selector}__body {
        &:before {
          border-top-color: #333;
        }
      }
    }
    #{$selector}__body {
      &_title,
      &_content {
        color: white;
      }

      background: #333333;
    }
  }
}
